/*
*编写程序处理vector<int>对象元素，将每个奇数值元素用该值的两倍替换
*/
#include <iostream>
#include <vector>
using namespace std;

int main()
{	
	vector<int> ivec(5);
	ivec[0] = 3;
	ivec[1] = 6;
	ivec[2] = 7;
	ivec[3] = 10;
	ivec[4] = 11;

	cout << "改变前vector元素值：" ;
	for(vector<int>::iterator iter = ivec.begin();iter != ivec.end();iter++)
	{
		cout << *iter << "  ";
	}

	cout << endl;

	//每个奇数值元素用该值的两倍替换并输出
	cout << "改变后vector元素值：" ;
	for(vector<int>::iterator iter = ivec.begin();iter != ivec.end();iter++)
	{
		if(*iter % 2 != 0)
		{
			*iter *= 2;
		}
		cout << *iter << "  ";
	}

	cout << endl;
	system("pause");
	return 0;
}